﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace ShopOnline.Controls
{
    public delegate void NeedDataSource(object sender, EventArgs e);

    public partial class LightBoxGallery : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        public NeedDataSource OnNeedDataSource
        {
            get;
            set;
        }

        public virtual void RefreshData()
        {
            if (OnNeedDataSource != null)
            {
                EventArgs e = new EventArgs();
                OnNeedDataSource(this, e);
                ScriptManager.RegisterStartupScript(this, typeof(Page), Guid.NewGuid().ToString(), "initLightbox();", true); 
            }
        }

        protected override void OnLoad(EventArgs e)
        {
        }

        string originalField;

        public string OriginalField
        {
            get { return originalField; }
            set { originalField = value; }
        }

        string thumbField;

        public string ThumbField
        {
            get { return thumbField; }
            set { thumbField = value; }
        }

        string defaultField;

        public string DefaultField
        {
            get { return defaultField; }
            set { defaultField = value; }
        }

        string descriptionField;

        public string DescriptionField
        {
            get { return descriptionField; }
            set { descriptionField = value; }
        }

        string idField;

        public string IDField
        {
            get { return idField; }
            set { idField = value; }
        }

        public Object DataSource
        {
            get { return rptImages.DataSource; }
            set { rptImages.DataSource = value; rptImages.DataBind(); }
        }

        public int RepeatColumns
        {
            get { return rptImages.RepeatColumns; }
            set { rptImages.RepeatColumns = value; }
        }

        public RepeatDirection RepeatDirection
        {
            get { return rptImages.RepeatDirection; }
            set { rptImages.RepeatDirection = value; }
        }

        public RepeatLayout RepeatLayout
        {
            get { return rptImages.RepeatLayout; }
            set { rptImages.RepeatLayout = value; }
        }

        public int ItemCount
        {
            get { return rptImages.Items.Count; }
        }

    }
}